#define _CRT_SECURE_NO_WARNINGS 1

int passway(int n, int n1, int* pn)
{
    int time = 0, N1 = 0, n2, N2 = 0;
    int y;
    n2 = n - n1;
    if (n < 0 || n1 >= n || n2 >= n)
    {
        return time;
    }
    else
    {
        for (time = 3;; time++)
        {
            if (N1 >= n1 && N2 >= n2)
                break;
            for (y = 1; y <= 9; y++)
            {
                N1 = (10 - y) * time;
                N2 = y * time / 3;
                if (N1 >= n1 && N2 >= n2) 
                {
                    *pn = 10 - y;
                    break;
                }
            }
        }
        return time - 1;
    }
}

char* MyStrNcpy(char* dst, const char* src, int n)
{
    int i = 0;
    while (i < n && src[i] != '\0')
    {
        dst[i] = src[i];
        i++;
    }
    while (i < n)
    {
        dst[i] = '\0';
        i++;
    }
    return dst;
}

int  MyStrlen(const char* pStr)
{
    int n = 0;
    while (pStr[n] != '\0')
    {
        n++;
    }
    return n;
}

int Judge_char(char* s)
{
    int n = 0;
    while (s[n] != '\0')
    {
        n++;
    }
    int i = 0;
    for (i = 0; i < n; i++)
    {
        if (s[i] != s[n - 1 - i])
            return 0;
    }
    return 1;
}

void fun(char* str[], int n, char* result)
{
    int i = 0;
    while (n--)
    {
        result[i] = *str[i];
        i++;
    }
    result[i] = '\0';
}